/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.aaron.test.dao;

import com.aaron.platform.dao.IDomainDao;
import com.aaron.platform.dao.IRoleDao;
import com.aaron.platform.dao.IUserDao;
import com.aaron.platform.entity.ItscDomainInfo;
import com.aaron.platform.entity.ItscRoleInfo;
import com.aaron.platform.entity.ItscUserInfo;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author mac
 */
public class RoleDaoTestCase extends AbstractDaoTestCase{

//    private IRoleDao roleDao;
//
//    public void setRoleDao(IRoleDao roleDao){
//        this.roleDao = roleDao;
//    }

    public void testFindByRoleName(){
        IRoleDao roleDao = (IRoleDao)applicationContext.getBean("roleDao");
        ItscRoleInfo roleInfo = null;
        roleInfo = roleDao.findRoleByName("admin");
        assertNotNull(roleInfo);

        roleInfo = null;
        roleInfo = roleDao.findRoleByName("viewer1");

        assertNull(roleInfo);
    }
    public void testFindByUsername(){
        IUserDao userDao = (IUserDao)applicationContext.getBean("userDao");
        ItscUserInfo userInfo = null;
        userInfo = userDao.findUserByName("aaron");
        assertNotNull(userInfo);

        userInfo = null;
        userInfo = userDao.findUserByName("viewer1");

        assertNull(userInfo);
    }

    public void testFindOrgByName(){
        IDomainDao orgDao = (IDomainDao)applicationContext.getBean("orgDao");
        ItscDomainInfo orgInfo = null;
        orgInfo = orgDao.findByName("网络部");
        assertNotNull(orgInfo);

        //assertEquals(orgInfo.getChildOrgs().size(), 4);
    }
}
